package com.api.syh56.shengyunhui.controller.admin;

import com.api.syh56.shengyunhui.common.CommonResult;
import com.api.syh56.shengyunhui.entity.User;
import com.api.syh56.shengyunhui.service.RoutesService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("admin/routes")
public class AdminRoutesController {
    @Autowired
    private RoutesService routesService;

    /**
     * 获取专线
     * @param pageNum
     * @param pageSize
     * @param departureCity 出发城市
     * @param arriveCity 到达城市
     * @return
     */
    @GetMapping("getRoutesByCity")
    public CommonResult<Object> getByCity(@RequestParam Integer pageNum,
                                          @RequestParam Integer pageSize,
                                          @RequestParam String departureCity,
                                          @RequestParam String arriveCity){
//        Page<User> routesByCity = routesService.getRoutesByCity(pageNum, pageSize, departureCity, arriveCity);
        Page<User> routesByCity = routesService.getRoutesByC(pageNum, pageSize, departureCity, arriveCity);
        return CommonResult.success(routesByCity);
    }
}
